package mypractice;

import com.sun.source.doctree.SummaryTree;

import java.util.Arrays;

import static java.io.ObjectInputFilter.merge;

public class Work2 {
    public static void main(String[] args) {
        int[] arr1=new int[]{1,2,3};
        int[] arr2= new int[]{2,2,2};
        System.out.println(Arrays.toString(merge(arr1, arr2)));

    }

    private static int[] merge(int[] arr1, int[] arr2) {
        int sum=arr1.length+arr2.length;
        int[] mergeInt=new int[sum];
        int i;
        for ( i = 0; i < arr1.length; i++) {
            mergeInt[i]=arr1[i];
        }
        for(int j=0;j<arr2.length;j++,i++){
            mergeInt[i]=arr2[j];
        }
        return mergeInt;
    }
}
